home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 19
/
CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso
/
CUCD
/
Readers
/
Gui4Cli
/
Tools
/
Rtn
/
ViewFile
< prev
Wrap
Text File
|
1997-12-02
|
3KB
|
137 lines
G4C
; ViewFile FileName FileType Mode
; FileName = the File Name
; FileType = the File Type, as returned from the GetFileType routine
; Mode = (optional) CLI or RUN (RUN is default)
; ======================================================================
xONLOAD filename filetype mode
guiopen viewfile $filename $filetype $mode
xONRELOAD filename filetype mode
guiopen viewfile $filename $filetype $mode
xONOPEN filename filetype mode
if $filename = ''
or $filetype = ''
return
endif
docase $filetype
; ----- do special cases first.
case = TEXT ; a text file (probably)
GuiLoad guis:tools/read.gc $viewfile/filename
return
break
case = INFO ; icons
cutvar filename cut char -5 ''
guiload guis:tools/icon.gc $viewfile/filename
return
break
case = G4C ; Yes.. you guessed it.
GuiLoad $filename
return
break
case = LHA ; LhA - all these are CLI'ied
cli 'Lha x $filename ram:'
return
break
case = LZX ; LZX
cli 'LZX x $filename ram:'
return
break
case = ZIP ; unzip
cli '$*DEF.UNZIP $filename -d ram:'
return
break
case = EXE ; A program ? - Use cli.gc to run it.
GuiLoad guis:tools/cli.gc $viewfile/filename RUN
return
break
case = UNKNOWN
; gui to deal with it..
guiopen ViewFile2
return
break
endcase
; If we got this far, then it's one of the simple types such as
; GIF or ILBM etc - We just contruct & issue the command to run it.
com = '\$*DEF.$filetype' ; construct command name
if $mode == CLI
CLI '$com $filename'
else
RUN '$com $filename'
endif
; routine ends here.
xOnQuit
guiquit ViewFile2
; ######################################################################
NEWFILE Viewfile2 ; last chance gui
; ######################################################################
WinBig 0 0 80 75 ""
WinType 00001000
winonmouse 40 10
varpath viewfile ; merge variables with the above file
xOnRMB
guiclose ViewFile2
xOnInactive
guiclose ViewFile2
xOnFail
ezreq "Error during operation" OK ""
;---------------> the Buttons
xbutton 0 0 0 15 MView
guiclose ViewFile2
run 'multiview $filename screen'
xbutton 0 15 0 15 List
GuiLoad guis:tools/read.gc $viewfile/filename
xbutton 0 30 0 15 Run
guiclose ViewFile2
run '$filename'
xbutton 0 45 0 15 With..
guiclose ViewFile2
prog = ''
ReqFile -1 -1 300 220 'Run file with..' LOAD prog hd1:Players
if $prog > ''
run '$prog $filename'
endif
xbutton 0 60 0 15 'CliGui'
guiclose ViewFile2
setvar cl_Main '$filename '
GuiLoad guis:tools/cli.gc $viewfile/filename CLI
setgad cli.gc 1 ON